package com.example.design.bridge.function;

import com.example.design.bridge.abst.factory.RegisterLoginComponentFactory;
import com.example.design.pojo.UserInfo;
import com.example.design.repo.UserRepository;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;


@Component
public class RegisterLoginByDefault extends AbstractRegisterLoginFunc implements RegisterLoginFuncInterface{

    @Resource
    private UserRepository userRepository;

    @PostConstruct
    private void initFuncMap(){
        RegisterLoginComponentFactory.funcMap.put("Default",this);
    }


    @Override
    public String login(String account, String password) {

        return super.commonLogin(account,password,userRepository);
    }

    @Override
    public String register(UserInfo userInfo) {

        return super.commonRegister(userInfo,userRepository);
    }

    @Override
    public boolean checkUserExists(String userName) {
       return super.commonCheckUserExists(userName,userRepository);
    }

    //瑕疵所在，不需要实现



}
